<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>View Timetable</title>
</h:head>
<f:view>
	<h:body>
		<ui:composition template="../includes/template.xhtml">
			<ui:define name="mainbody">
				<p:panel header=" View Time Table" style="min-height: 550px"
					styleClass="prime_panel">

					<h:form id="form">
						<p:dataTable style="width: 100%" id="slots" var="slot"
							value="#{viewTimetable.timetableModel}" paginator="true"
							paginatorAlwaysVisible="true" rows="10" widgetVar="slot">

							<p:column filterBy="#{slot.day}" style="width:10%">
								<f:facet name="header">
									<h:outputText value="Day" />
								</f:facet>
								<h:outputText rendered="#{slot.day eq 1}" value="Monday" />
								<h:outputText rendered="#{slot.day eq 2}" value="Tuesday" />
								<h:outputText rendered="#{slot.day eq 3}" value="Wednesday" />
								<h:outputText rendered="#{slot.day eq 4}" value="Thursday" />
								<h:outputText rendered="#{slot.day eq 5}" value="Friday" />
								<h:outputText rendered="#{slot.day eq 6}" value="Saturday" />
							</p:column>

							<p:column
								filterBy="#{slot.section.clas.classTitle} #{slot.section.sectionTitle}"
								style="width:20%">
								<f:facet name="header">
									<h:outputText value="Class" />
								</f:facet>
								<h:outputText value="#{slot.section.clas.classTitle}" />
								<h:outputText value="#{slot.section.sectionTitle}" />
							</p:column>

							<p:column filterBy="#{slot.teacher.name}" style="width:17%">
								<f:facet name="header">
									<h:outputText value="Teacher" />
								</f:facet>
								<h:outputText value="#{slot.teacher.name}" />
							</p:column>

							<p:column filterBy="#{slot.course.title}" style="width:20%">
								<f:facet name="header">
									<h:outputText value="Course" />
								</f:facet>
								<h:outputText value="#{slot.course.title}" />
							</p:column>

							<p:column filterBy="#{slot.room.roomTitle}" style="width:8%">
								<f:facet name="header">
									<h:outputText value="Room" />
								</f:facet>
								<h:outputText value="#{slot.room.roomTitle}" />
							</p:column>

							<p:column filterBy="#{slot.startTime} #{slot.endTime}"
								style="width:25%">
								<f:facet name="header">
									<h:outputText value="Time" />
								</f:facet>
								<h:outputText value="#{slot.startTime}-#{slot.endTime}" />
							</p:column>


						</p:dataTable>
						<center>
							<h:panelGrid columns="3">
								<p:panel header="Export All Data">
									<h:commandLink>
										<p:graphicImage value="../../../images/export-icons/excel.png"
											width="50" height="50" />
										<p:dataExporter type="xls" target="slots" fileName="Timetable" />
									</h:commandLink>

									<h:commandLink>
										<p:graphicImage value="../../../images/export-icons/pdf.png"
											width="50" height="50" />
										<p:dataExporter type="pdf" target="slots" fileName="Timetable"
											preProcessor="#{viewTimetable.preProcessPDF}" />
									</h:commandLink>

									<h:commandLink>
										<p:graphicImage value="../../../images/export-icons/csv.png"
											width="50" height="50" />
										<p:dataExporter type="csv" target="slots" fileName="Timetable" />
									</h:commandLink>

									<h:commandLink>
										<p:graphicImage value="../../../images/export-icons/xml.png"
											width="50" height="50" />
										<p:dataExporter type="xml" target="slots" fileName="Timetable" />
									</h:commandLink>
								</p:panel>

								<p:panel header="Export Page Data">
									<h:commandLink>
										<p:graphicImage value="../../../images/export-icons/excel.png"
											width="50" height="50" />
										<p:dataExporter type="xls" target="slots" fileName="Timetable"
											pageOnly="true" />
									</h:commandLink>

									<h:commandLink>
										<p:graphicImage value="../../../images/export-icons/pdf.png"
											width="50" height="50" />
										<p:dataExporter type="pdf" target="slots" fileName="Timetable"
											pageOnly="true" />
									</h:commandLink>

									<h:commandLink>
										<p:graphicImage value="../../../images/export-icons/csv.png"
											width="50" height="50" />
										<p:dataExporter type="csv" target="slots" fileName="Timetable"
											pageOnly="true" />
									</h:commandLink>

									<h:commandLink>
										<p:graphicImage value="../../../images/export-icons/xml.png"
											width="50" height="50" />
										<p:dataExporter type="xml" target="slots" fileName="Timetable"
											pageOnly="true" />
									</h:commandLink>
								</p:panel>

								<p:panel header="Print" style="width:250px">
									<center>
										<h:commandButton value="Print" type="button"
											icon="ui-icon-print" style="height:50px; width:80px">
											<p:printer target="slots" />
										</h:commandButton>
									</center>
								</p:panel>
							</h:panelGrid>
						</center>



					</h:form>

				</p:panel>

			</ui:define>
		</ui:composition>
	</h:body>
</f:view>
</html>
